from api.depa_manage_api import DepaManage
from common.assert_tools import assert_tools
from common.login_token import login_token
class TestDepaManage(object):
    def setup_class(self):
        self.depa=DepaManage()
        self.head_data = login_token()
        print("--------------获取令牌-----------------")

    def test_query_depa(self):
        depa_id = "1570968259581308928"
        resp1 = self.depa.query_depa(depa_id, self.head_data)
        print("查询", resp1.json())
        assert_tools(resp1, 200, True, 10000, "操作成功")

    def test_add_depa(self):
        depa_data = {"name": "德玛西亚", "code": "9527"}
        resp2 = self.depa.add_depa(self.head_data, depa_data)
        print("添加", resp2.json())
        assert_tools(resp2, 200, True, 10000, "操作成功")

    def test_modify_depa(self):
        depa2_id = "1570968259581308928"
        query_data = {"name": "德玛88", "code": "9566666"}
        resp3 = self.depa.modify_depa(depa2_id, self.head_data, query_data)
        print("修改", resp3.json())
        assert_tools(resp3, 200, True, 10000, "操作成功")

    def test_delete_depa(self):
        depa3_id = "1570968259581308928"
        resp4 = self.depa.delete_depa(depa3_id, self.head_data)
        print("删除", resp4.json())
        assert_tools(resp4, 200, True, 10000, "操作成功")